Skip to content

Conversation

@jaxtell
Copy link

@jaxtell jaxtell commented May 18, 2022

No description provided.


import javax.servlet.http.HttpServletResponse;

@RequestMapping(value = "/payment")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any comment on how the endpoint should look if you were to design it without pattern following?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how it would be used. If user id is always going to be present it might make sense to be /user/{userId}/payment. If there are future requests that allow searching across users then I'd leave it top level. Instead of using words in the URL I'd favor http verbs to indicate action, e.g. GET on /payment/user/{userId} to get all payments for a user and/or GET on /payment with parameters to get payment(s) based on query parameters, PUT on /payment to add a payment, PATCH on /payment to update a payment, POSTs on /payment/[ACTION] for more complex operations. I'd want to balance keeping the URL short while still being descriptive of what it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants